// pages/search/search.js
var app = getApp();
var ImageURL = app.globalData1.ImageURL;
var hostURL = app.globalData1.hostURL;
Page({


  data: {
    list: [],
    searchInput: '',

  },
  onLoad: function () {
  },

  listenerSearchInput: function (e) {
    this.setData({
      searchInput: e.detail.value
    })

  },
  zzh: function (e) {
    var sourceId = e.currentTarget.dataset.id
    console.log(sourceId)
    wx.navigateTo({
      url: "/pages/goods/goods?sourceId=" + e.currentTarget.dataset.id,
    })

  },
  toSearch: function () {
    var that = this;
    console.log("进入onload")
    wx.request({
      url: hostURL + 'sharedplatform-web/search/searchByName.action',
      method: 'get',
      data: {
        sourceName: that.data.searchInput
      },
      header: {
        'Accept': 'application/json'
      },
      success: function (res) {
        that.setData({

          list: res.data.sourceList

        });
        console.log(that.data.list)

      }
    })

  }

})